package com.example.eldersystem.operatedata.mapper;

import com.example.eldersystem.operatedata.model.Detector;
import org.apache.ibatis.annotations.*;
import java.util.List;


public interface DetectorMapper {

    @Insert("insert into detector(ip,port,type,name) " +
            "values (#{ip},#{port},#{type},#{name}) ")
    int addDetector(Detector detector);

    @Select("select count(*) from detector")
    int selectDetectorNum();

    @Select("select * from detector")
    @Results(id="select1",value = {
            @Result(id = true,property = "id",column = "detector_id"),
            @Result(property = "ip",column = "ip"),
            @Result(property = "port",column = "port"),
            @Result(property = "type",column = "type"),
            @Result(property = "name",column = "name"),
    })
    List<Detector> selectDetector();
}
